package com.itcast.cn.servlet;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

/**
 * <p>Servlet学习: urlPatterns配置</p>
 *
 * 目录匹配
 * @author hyatt 2022/1/13 17:18
 * @version 1.0
 */
@WebServlet(urlPatterns = {"/user/*"})
public class ServletTest5 extends HttpServlet {

    /**
     * 重写HttpServlet的get方法
     *      * 调用HttpServlet的service方法，然后分流
     *      * 具体的实现可以查看HttpServlet的源码
     * @param req
     * @param resp
     * @throws ServletException
     * @throws IOException
     */
    @Override
    protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        System.out.println("ServletTest5 get......");
    }

    @Override
    protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        System.out.println("ServletTest5 post......");
    }
}